<?php
/**
* Action map Modeller
* @author: trungdt
* @since: Feb 1, 2011
* 
* Change logs
* Feb 1, 2011 - trungdt - First create
* Feb 11, 2011 - trungdt - Add Params map
* Oct 20, 2012 - trungdt - Add language and is_mobile
*/
class actions_map {
	function form($object) {
		if (!defined('SYS_FORMS')) require_once(BASE.'subsystems/forms.php');
		exponent_forms_initialize();
		
		global $db;
		
		$form = new form();
	
		if (!isset($object->id)) {
			$object->name = '';
			$object->module = '';
			$object->views = '';
			$object->action = '';     
			$object->src = '';     
            $object->params_map = '';     
            $object->language = LANG;
			$object->is_mobile = false;
		} else {
			$form->meta('id',$object->id);
		}
		
		$form->register('name','Source SEO URL',new textcontrol($object->name,50,false,100,"",true));
		$form->register('cmodule','Module name',new textcontrol($object->module,50,false,100,"",true));
		$form->register('caction','Action name',new textcontrol($object->action,50,false,100,"",true));
		$form->register('cviews','Views',new textcontrol($object->views,50,false,100,"",false));
		$form->register('csrc','Module source loc',new textcontrol($object->src,50,false,100,"",false));
		$form->register('params_map','Params map (split by spacebar)',new textcontrol($object->params_map,50));
        $form->register('language',"Language",new dropdowncontrol($object->language, exponent_lang_list()));
        $form->register('is_mobile',"Is this SEO Map Link For Mobile",new checkboxcontrol($object->is_mobile, true));
		
		$form->register('submit','',new buttongroupcontrol('Save','','Cancel'));
		return $form;
	}
	
	function update($values,$object) {
		$object->name = $values['name'];
		$object->module = $values['cmodule'];
		$object->views = $values['cviews'];
		$object->action = $values['caction'];
		$object->src = $values['csrc'];
        $object->params_map = $values['params_map'];
        $object->language = $values['language'];
		$object->is_mobile = isset($values['is_mobile'])?1:0;
		return $object;
	}
}

?>
